<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
    <title th:text="${title}"></title>
    <link rel="icon" href="/global/img/core-img/favicon.ico">
    <link rel="stylesheet" href="/global/css/style.css">
</head>
<body>
<div th:include="public::topbar"></div>
<div class="container">
    <ul class="nav nav-tabs">
        <li class="nav-item">
            <a class="nav-link active" data-toggle="tab" href="#message"><span class="fa fa-envelope"></span> Message</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" data-toggle="tab" href="#news"><span class="fa fa-newspaper-o"></span> News</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" data-toggle="tab" href="#system"><span class="fa fa-bell"></span> System</a>
        </li>
    </ul>
    <div class="tab-content">
        <div id="message" class="container tab-pane active">
            <div class="card" th:each="msg:${messages}">
                <div class="card-header">
                    <a class="d-flex card-link text-black" data-toggle="collapse" th:href="${'#m' + msg.id}">
                        <span class="flex-grow-1 messagetitle" th:text="${msg.content}"></span>
                        <span th:text="${msg.sender}"></span>
                        <span th:text="${msg.date}"></span>
                    </a>
                </div>
                <div th:id="${'m' + msg.id}" class="collapse">
                    <div class="card-body" th:utext="${msg.content}"></div>
                </div>
            </div>
            <div class="jumbotron" th:if="${messages.isEmpty()}">
                <br/>
                <p>No new Message.</p>
            </div>
        </div>
        <div id="news" class="container tab-pane fade">
            <div class="card" th:each="msg:${news}" th:switch="${msg.type}">
                <div class="card-header" th:case="${msg.TYPE_NEWS}">
                    <a class="d-flex card-link text-black" data-toggle="collapse" th:href="${'#n' + msg.id}">
                        <span class="flex-grow-1 messagetitle" th:text="${msg.title}"></span>
                        <span th:text="${msg.sender}"></span>
                        <span th:text="${msg.date}"></span>
                    </a>
                </div>
                <div class="card-header bg-info" th:case="${msg.TYPE_NEWS_IMP}">
                    <a class="d-flex card-link text-white" data-toggle="collapse" th:href="${'#n' + msg.id}">
                        <span class="flex-grow-1 messagetitle" th:text="${msg.title}"></span>
                        <span th:text="${msg.sender}"></span>
                        <span th:text="${msg.date}"></span>
                    </a>
                </div>
                <div th:id="${'n' + msg.id}" class="collapse">
                    <div class="card-body" th:utext="${msg.content}"></div>
                </div>
            </div>
            <div class="jumbotron" th:if="${news.isEmpty()}">
                <br/>
                <p>No new News.</p>
            </div>
        </div>
        <div id="system" class="container tab-pane fade">
            <div class="card" th:each="msg:${system}" th:switch="${msg.type}">
                <div class="card-header" th:case="${msg.TYPE_SYS}">
                    <a class="d-flex card-link text-black" data-toggle="collapse" th:href="${'#s' + msg.id}">
                        <span class="flex-grow-1" th:text="${msg.title}"></span>
                        <span th:text="${msg.sender}"></span>
                        <span th:text="${msg.date}"></span>
                    </a>
                </div>
                <div class="card-header bg-info" th:case="${msg.TYPE_SYS_IMP}">
                    <a class="d-flex card-link text-white" data-toggle="collapse" th:href="${'#s' + msg.id}">
                        <span class="flex-grow-1" th:text="${msg.title}"></span>
                        <span th:text="${msg.sender}"></span>
                        <span th:text="${msg.date}"></span>
                    </a>
                </div>
                <div th:id="${'s' + msg.id}" class="collapse">
                    <div class="card-body" th:utext="${msg.content}"></div>
                </div>
            </div>
            <div class="jumbotron" th:if="${system.isEmpty()}">
                <br/>
                <p>No new notification.</p>
            </div>
        </div>
    </div>
</div>
<div th:include="public::bottombar"></div>
<script src="/global/js/jquery-2.2.4.min.js"></script>
<script src="/global/js/popper.min.js"></script>
<script src="/global/bootstrap/js/bootstrap.min.js"></script>
<script src="/global/js/plugins.js"></script>
<script src="/global/js/active.min.js"></script>
<script src="/global/js/events.min.js"></script>
</body>
</html>
